// const baseURL = "https://www.xazhsq.cn/law-boot"; //线上地址 （试点）  AppID：  wxadbdbdee0f9f42bd
// const baseURL = "https://www.xazhsq.cn/wg-law"; // 武功    AppID：  wxb57ae260d82698a2
// const baseURL = "https://www.xazhsq.cn/zry-law"; // 测试地址    AppID：  wxadbdbdee0f9f42bd
// const baseURL = "https://www.xazhsq.cn/db-law/"; // 定边 appid: wxe2f305fda6044071 ×  wxe23b214c329cf472 √
// const baseURL = "https://www.xazhsq.cn/zy-law"; // 紫阳县   AppID：  wx0aa7f5f827e15e51
// const baseURL = "https://www.xazhsq.cn/hk-law"; // 恒口   AppID：  wxc56922c5dc4c7cc3

import { parseJson } from "./utils/util";

// const baseURL = "https://www.xazhsq.cn/zry-law"; //仝

function generateConfig(envName) {
  const configMap = {
    汉中市: {
      cityList: [
        {
          name: "汉中市",
          active: false,
          avaliable: true,
          url: "https://www.xazhsq.cn/hz", // wxe23b214c329cf472
        },
        {
          name: "榆林市",
          active: false,
          avaliable: true,
          url: "https://www.xazhsq.cn/yl-law-boot",
        },
        {
          name: "宝鸡市",
          active: false,
          avaliable: true,
          url: "https://www.xazhsq.cn/bj",
        },
      ],
      mapKey: "PCFBZ-EGIL3-OHZ3Q-YNJDC-HCTJ7-OPBWX", // 腾讯地图 key
      tmplIds: ["RmLkV2yKq1eD0z74Y8YgXK1-cTNTmw8vvI5msrRn70g"],
    },
    西安市: {
      cityList: [
        {
          name: "西安市", // wxadbdbdee0f9f42bd
          active: false,
          avaliable: true,
          url: "https://www.xazhsq.cn/zry-law",
          // url: 'http://192.168.1.182:8080/law-boot'
        },
        {
          name: "西安law-demo",
          active: false,
          avaliable: true,
          url: "https://www.xazhsq.cn/demo-boot",
        },
      ],
      mapKey: "AZPBZ-DNUHN-IEOF2-SK7R5-DTL6K-NOFEY",
      tmplIds: ["GKej7y_KhoHynDMXpwT-uYZpl1Q1Ll9HaDM-lvlobqI"],
    },
  };

  return configMap[envName];
}

// const dynamicConfig = generateConfig('汉中市') // appid wxe23b214c329cf472
const dynamicConfig = generateConfig("西安市"); // appid wxadbdbdee0f9f42bd

export const cityList = dynamicConfig.cityList;
export const wxMapkey = dynamicConfig.mapKey;
export const tmplIds = dynamicConfig.tmplIds;

// const baseURL = "http://192.168.1.37:8080/law-boot"; // 黄贺

//文件静态目录 放置 icon等
const baseImgUrl = "https://www.xazhsq.cn/webPicture/minilaw/";

const clientId = "1P5UL8TmHquq5FFxdgfAPc5O"; // 百度ocr  API key
const clientSecret = "8e4B7Vcevw0hUYGuZP7mjGGuV0dtVlFu"; // 百度ocr  Secret Key

const timeout = 10000;
export { baseImgUrl, clientId, clientSecret, timeout };

export const config = {
  baseImgUrl,
  clientId,
  clientSecret,
  timeout,
  role: "mini",
  roleConfig: {
    mini: {
      requestTokenName: "X-MINI-TOKEN",
    },
    fj: {
      requestTokenName: "X-FJ-TOKEN",
    },
    wgy: {
      requestTokenName: "X-WGY-TOKEN",
    },
  },
};

export function setRole(role) {
  uni.setStorageSync("role", role);
  config.role = role;
}

export function getRole() {
  return uni.getStorageSync("role");
}

// 电子政务外网 地域 put delete

export const regionAreaList = ["汉中市", "宝鸡市"];
